 /* Basic editor styles */
.tiptap {
  :first-child {
    margin-top: 0;
  }

  /* List styles */
  ul, 
  ol {
    padding: 0 1rem;
    margin: 1.25rem 1rem 1.25rem 0.4rem;
    
    li p {
      margin-top: 0.25em;
      margin-bottom: 0.25em;
    }
  }

  /* Heading styles */
  h1, 
  h2, 
  h3, 
  h4, 
  h5, 
  h6 {
    line-height: 1.1;
    margin-top: 2.5rem;
    text-wrap: pretty;
  }

  h1, 
  h2 {
    margin-top: 3.5rem;
    margin-bottom: 1.5rem;
  }

  h1 { 
    font-size: 1.4rem; 
  }

  h2 { 
    font-size: 1.2rem; 
  }

  h3 { 
    font-size: 1.1rem; 
  }

  h4, 
  h5, 
  h6 { 
    font-size: 1rem; 
  }

  /* Code and preformatted text styles */
  code {
    background-color: var(--purple-light);
    border-radius: 0.4rem;
    color: var(--black);
    font-size: 0.85rem;
    padding: 0.25em 0.3em;
  }

  pre {
    background: var(--black);
    border-radius: 0.5rem;
    color: var(--white);
    font-family: 'JetBrainsMono', monospace;
    margin: 1.5rem 0;
    padding: 0.75rem 1rem;

    code {
      background: none;
      color: inherit;
      font-size: 0.8rem;
      padding: 0;
    }
  }

  mark {
    background-color: #FAF594;
    border-radius: 0.4rem;
    box-decoration-break: clone;
    padding: 0.1rem 0.3rem;
  }

  blockquote {
    border-left: 3px solid var(--gray-3);
    margin: 1.5rem 0;
    padding-left: 1rem;
  }

  hr {
    border: none;
    border-top: 1px solid var(--gray-2);
    margin: 2rem 0;
  }

  p {
    word-break: break-all;
  }

  /* Give a remote user a caret */
  .collaboration-cursor__caret {
    border-left: 1px solid #0d0d0d;
    border-right: 1px solid #0d0d0d;
    margin-left: -1px;
    margin-right: -1px;
    pointer-events: none;
    position: relative;
    word-break: normal;
  }

  /* Render the username above the caret */
  .collaboration-cursor__label {
    border-radius: 3px 3px 3px 0;
    color: #0d0d0d;
    font-size: 12px;
    font-style: normal;
    font-weight: 600;
    left: -1px;
    line-height: normal;
    padding: 0.1rem 0.3rem;
    position: absolute;
    top: -1.4em;
    user-select: none;
    white-space: nowrap;
  }
}

/* History Panel Styles */
.history-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  background: var(--white, #ffffff);
  border-radius: 0.5rem;
  border: 1px solid var(--gray-3, #e5e5e5);
  width: 100%;
  min-width: 280px;
  max-width: 400px;

  .option-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;

    .label-large {
      font-size: 0.875rem;
      font-weight: 600;
      color: var(--black, #000000);
    }

    .label-small {
      font-size: 0.75rem;
      color: var(--gray-5, #666666);
      line-height: 1.4;
    }

    .switch-group {
      display: flex;
      gap: 1rem;

      label {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.875rem;
        cursor: pointer;

        input[type="radio"] {
          margin: 0;
        }
      }
    }

    .commit-panel {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;

      input {
        padding: 0.5rem;
        border: 1px solid var(--gray-3, #e5e5e5);
        border-radius: 0.25rem;
        font-size: 0.875rem;
        width: 100%;
        box-sizing: border-box;

        &:disabled {
          background-color: var(--gray-1, #f5f5f5);
          color: var(--gray-5, #666666);
          cursor: not-allowed;
        }

        &:focus {
          outline: none;
          border-color: var(--purple, #6366f1);
          box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
        }
      }

      button {
        background-color: rgb(45, 45, 47) !important;
        color: white !important;
        border: 1px solid rgb(45, 45, 47) !important;
        padding: 0.5rem 1rem;
        border-radius: 0.25rem;
        font-size: 0.875rem;
        cursor: pointer;
        transition: all 0.2s ease;

        &:hover {
          background-color: rgb(35, 35, 37) !important;
          border-color: rgb(35, 35, 37) !important;
        }

        &:disabled {
          background-color: var(--gray-1, #f5f5f5) !important;
          color: var(--gray-5, #666666) !important;
          cursor: not-allowed !important;
          border-color: var(--gray-2, #e0e0e0) !important;

          &:hover {
            background-color: var(--gray-1, #f5f5f5) !important;
          }
        }
      }
    }
  }

  hr {
    border: none;
    border-top: 1px solid var(--gray-2, #e0e0e0);
    margin: 0;
  }
}

.col-group {
  display: flex;
  flex-direction: row;

  @media (max-width: 540px) {
    flex-direction: column-reverse;
  }
}

.main {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.sidebar {
  border-left: 1px solid var(--gray-3);
  flex-grow: 0;
  flex-shrink: 0;
  padding: 1rem;
  width: 15rem;
  position: sticky;
  height: 100vh;
  top: 0;

  @media (min-width: 800px) {
    width: 20rem;
  }

  @media (max-width: 540px) {
    border-bottom: 1px solid var(--gray-3);
    border-left: unset;
    width: 100%;
    height: auto;
    position: unset;
    padding: 1.5rem;
  }
}

.sidebar-options {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.option-group {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  width: 100%;

  form {
    width: 100%;

    input {
      width: 100%;
    }
  }
}

.versions-group {
  border-bottom: 1px solid var(--gray-3);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
  padding-bottom: 1rem;
  width: 100%;
  max-height: 300px;
  min-height: 100px;

  @media (max-width: 540px) {
    border-bottom: unset;
    flex-direction: column;
    flex: unset;
    padding-bottom: 0;
    max-height: 200px;
  }

  button {
    background-color: unset;
    color: var(--black);
    display: flex;
    flex-direction: column;
    font-size: 0.8125rem;
    font-weight: 500;
    gap: 0.375rem;
    line-height: 1.15;
    padding: 0.625rem;
    text-align: left;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    flex-shrink: 0;
    
    &:hover {
      background-color: var(--gray-3);
    }
    
    &.is-active {
      background-color: #3b82f6 !important;
      color: white !important;
      border: 1px solid #3b82f6 !important;
      box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
  
      &:hover {
        background-color: #2563eb !important;
        border-color: #2563eb !important;
      }
      
      span {
        color: rgba(255, 255, 255, 0.8) !important;
      }
    }

    span {
      color: var(--gray-5);
      font-size: 0.75rem;
      font-weight: 400;
      text-align: left;
      word-wrap: break-word;
      overflow-wrap: break-word;
    }
  }

  /* 自定义滚动条样式 */
  &::-webkit-scrollbar {
    width: 6px;
  }

  &::-webkit-scrollbar-track {
    background: var(--gray-1, #f5f5f5);
    border-radius: 3px;
  }

  &::-webkit-scrollbar-thumb {
    background: var(--gray-4, #9ca3af);
    border-radius: 3px;
    
    &:hover {
      background: var(--gray-5, #6b7280);
    }
  }
}

/* Dialog styling */
body:has(.dialog[data-state="open"]) {
  overflow: hidden;
  pointer-events: none; 
}

.dialog {
  pointer-events: visible;
  display: none;

  &[data-state="open"] {
    display: inherit;
  }

  &:before {
    background-color: rgba(0, 0, 0, 0.5);
    content: "";
    height: 100%;
    left: 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
  }

  .sidebar {
    height: 100%;
    position: unset;

    @media (max-width: 540px) {
      height: unset;
    }
  }
}

.dialog-content {
  background: #fff;
  border-radius: 1rem;
  height: calc(100% - 1rem);
  left: 50%;
  max-height: 800px;
  max-width: 1200px;
  overflow: hidden;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 1rem);
  z-index: 101;

  .main {
    overflow: auto;
  }
}

/* Button Group Styles */
.button-group {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;

  button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-3, #e5e5e5);
    border-radius: 0.25rem;
    background: var(--white, #ffffff);
    color: var(--black, #000000);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;

    &:hover {
      background-color: var(--gray-1, #f5f5f5);
    }

    &.primary {
      background-color: var(--purple, #6366f1);
      color: var(--white, #ffffff);
      border-color: var(--purple, #6366f1);

      &:hover {
        background-color: var(--purple-dark, #4f46e5);
      }
    }

    &:disabled {
      background-color: var(--gray-1, #f5f5f5);
      color: var(--gray-5, #666666);
      cursor: not-allowed;
      border-color: var(--gray-2, #e0e0e0);

      &:hover {
        background-color: var(--gray-1, #f5f5f5);
      }
    }
  }
}

/* Label styles */
.label-large {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--black, #000000);
}

.label-small {
  font-size: 0.75rem;
  color: var(--gray-5, #666666);
  line-height: 1.4;
}

/* Switch group styles */
.switch-group {
  display: flex;
  gap: 1rem;

  label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;

    input[type="radio"] {
      margin: 0;
    }
  }
}

/* Commit panel styles */
.commit-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  input {
    padding: 0.5rem;
    border: 1px solid var(--gray-3, #e5e5e5);
    border-radius: 0.25rem;
    font-size: 0.875rem;

    &:disabled {
      background-color: var(--gray-1, #f5f5f5);
      color: var(--gray-5, #666666);
      cursor: not-allowed;
    }

    &:focus {
      outline: none;
      border-color: var(--purple, #6366f1);
      box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
    }
  }
}